/**
 * 钉钉工具
 */
var DDUtil = {};
/**
 * 是否安装
 * @return {Boolean}
 * @public
 */
DDUtil.isInstalled = function () {
    if (cc.sys.os == cc.sys.OS_IOS) {
        return jsb.reflection.callStaticMethod('DDUtil', 'isInstalled');
    } else if (cc.sys.os == cc.sys.OS_ANDROID) {
        return jsb.reflection.callStaticMethod(packageUri + '/utils/DDUtil', 'isInstalled', '()Z');
    }
};
/**
 * 分享回调
 * @param code
 * @public
 */
DDUtil.shareResq = function (code) {
    eventManager.dispatchEvent(EventKey.ReceiveDingTalkShare, code);
};
/**
 * 分享网址
 * @param {String} url
 * @param {String} title
 * @param {String} description
 * @public
 */
DDUtil.shareUrl = function (url, title, description) {
    if (cc.sys.os == cc.sys.OS_IOS) {
        jsb.reflection.callStaticMethod(
            'DDUtil',
            'shareUrl:title:description:',
            url, title, description
        );
    } else if (cc.sys.os == cc.sys.OS_ANDROID) {
        jsb.reflection.callStaticMethod(
            packageUri + '/utils/DDUtil',
            'shareUrl', '(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V',
            url, title, description
        );
    }
};
/**
 * 分享网址
 * @param {String} url
 * @param {String} title
 * @param {String} description
 * @param {String} path
 * @public
 */
DDUtil.shareUrlWithIcon = function (url, title, description, path) {
    if (cc.sys.os == cc.sys.OS_IOS) {
        jsb.reflection.callStaticMethod(
            'DDUtil',
            'shareUrlWithIcon:title:description:path:',
            url, title, description, path
        );
    } else if (cc.sys.os == cc.sys.OS_ANDROID) {
        jsb.reflection.callStaticMethod(
            packageUri + '/utils/DDUtil',
            'shareUrlWithIcon', '(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V',
            url, title, description, path
        );
    }
};
/**
 * 分享图片
 * @param {String} path
 * @public
 */
DDUtil.sharePic = function (path) {
    if (cc.sys.os == cc.sys.OS_IOS) {
        jsb.reflection.callStaticMethod(
            'DDUtil',
            'sharePic:',
            path
        );
    } else if (cc.sys.os == cc.sys.OS_ANDROID) {
        jsb.reflection.callStaticMethod(
            packageUri + '/utils/DDUtil',
            'sharePic', '(Ljava/lang/String;)V',
            path
        );
    }
};
/**
 * 截图
 * @param {cc.Node} node
 * @public
 */
DDUtil.shareCapture = function (node) {
    captureNode(node, function (path) {
        DDUtil.sharePic(path);
    });
};
/**
 * 分享文本
 * @param {String} text
 */
DDUtil.shareText = function (text) {
    if (cc.sys.os == cc.sys.OS_IOS) {
        jsb.reflection.callStaticMethod(
            'DDUtil',
            'shareText:',
            text
        );
    } else if (cc.sys.os == cc.sys.OS_ANDROID) {
        jsb.reflection.callStaticMethod(
            packageUri + '/utils/DDUtil',
            'shareText', '(Ljava/lang/String;)V',
            text
        );
    }
};
